package com.llseven.ai.spring.llseven.model;

/**
 * @author ywb
 * @date 2025-04-16 13:40
 */

import com.google.gson.Gson;

import java.util.Map;

public class ResultModel<T> {
    public int status;
    
    public String msg;
    
    public T data;
    
    public ResultModel() {
    }
    
    public ResultModel(int status, String message, T data) {
        this.status = status;
        this.msg = message;
        this.data = data;
    }
    
    public ResultModel(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }
    
    public static <T> ResultModel<T> success(T data) {
        return new ResultModel<>(200, "SUCCESS", data);
    }
    
    public static ResultModel<Map<String, String>> success() {
        return new ResultModel<>(200, "SUCCESS");
    }
    
    @Override
    public String toString() {
        return new Gson().toJson(this);
    }
}
